package com.spzx.channel.service.impl;

import com.spzx.channel.service.BrandService;
import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.domain.R;
import com.spzx.common.core.exception.ServiceException;
import com.spzx.product.api.RemoteBrandService;
import com.spzx.product.api.domain.Brand;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Haoran Sun
 * @since 2024/07/24
 */

@Service
public class BrandServiceImpl implements BrandService {

    @Resource
    private RemoteBrandService remoteBrandService;

    @Override
    public List<Brand> getBrandAll() {
        R<List<Brand>> result = remoteBrandService.getBrandAllList(SecurityConstants.INNER);
        if (R.isSuccess(result))  return result.getData();
        throw new ServiceException(result.getMsg());
    }
}
